import java.awt.*;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: YKH
 * Date: 2022-05-05
 * Time: 17:08
 * author:Test01
 */
public class Test01 {
    public static void main(String[] args) {
        Frame frame = new Frame();
        frame.setVisible(true);
        frame.setBounds(200,200,500,600);
        frame.setBackground(Color.BLACK);
        frame.setLayout(new GridLayout(2,1));
        //创建面板
        Panel panel1 = new Panel();
        panel1.setLayout(new BorderLayout());
        Panel panel2 = new Panel();
        panel2.setLayout(new GridLayout(2,1));


        //创建按钮
        //上一半
        panel1.add(new Button("west-1"),BorderLayout.WEST);
        panel1.add(new Button("east-1"),BorderLayout.EAST);
        panel1.add(panel2,BorderLayout.CENTER);
        panel2.add(new Button("1"));
        panel2.add(new Button("2"));
        frame.add(panel1);

        //下一半
        Panel panel3 = new Panel();
        Panel panel4 = new Panel();
        panel3.setLayout(new BorderLayout());
        panel4.setLayout(new GridLayout(2,2));

        //添加按钮
        for( int i=0;i<4;i++) {
            panel4.add(new Button("i+3"));
        }

        panel3.add(new Button("west-2"),BorderLayout.WEST);
        panel3.add(new Button("east-2"),BorderLayout.EAST);
        panel3.add(panel4);

        frame.add(panel3);
    }
}
